//
//  MessageTableViewCell.m
//  chongwu
//
//  Created by 隼目 on 2021/9/23.
//

#import "MessageTableViewCell.h"

@implementation MessageTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(CGFloat)creatView{
    self.backgroundColor=[UIColor clearColor];
    
    UIView *backView=[UIView new];
    [self.contentView addSubview:backView];
    [backView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(30*_mainHeight);
        make.right.mas_equalTo(-30*_mainWidth);
        make.top.mas_equalTo(10*_mainHeight);
        make.bottom.mas_equalTo(-10*_mainHeight);
    }];
    backView.backgroundColor=[UIColor whiteColor];
    backView.layer.cornerRadius=25*_mainWidth;
    backView.layer.shadowColor = rgba(74,31,0,0.1).CGColor;
    backView.layer.shadowOffset = CGSizeMake(0,0);
    backView.layer.shadowOpacity = 1;
    backView.layer.shadowRadius = 2;
    
    UILabel *titleLabel=[UILabel new];
    [backView addSubview:titleLabel];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(74*_mainWidth);
        make.top.mas_equalTo(27*_mainHeight);
    }];
    [titleLabel layoutIfNeeded];
    titleLabel.font=[UIFont fontWithName:@"PingFang SC" size:autoScaleW(24)];
    titleLabel.text=@"08/08 12:00";
    titleLabel.textColor=rgba(102,102,102,1);
    
    UIView *quanView=[UIView new];
    [backView addSubview:quanView];
    [quanView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(titleLabel.mas_left).mas_equalTo(-24*_mainWidth);
        make.centerY.mas_equalTo(titleLabel);
        make.width.height.mas_equalTo(20*_mainWidth);
    }];
    quanView.layer.cornerRadius=10*_mainWidth;
    quanView.layer.masksToBounds=YES;
    
    UILabel *contentLabel=[UILabel new];
    [backView addSubview:contentLabel];
    [contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(30*_mainWidth);
        make.top.mas_equalTo(80*_mainHeight);
        make.right.mas_equalTo(-30*_mainWidth);
    }];
    contentLabel.numberOfLines=0;
    contentLabel.text=@"您寄出的订单3456524552245已发出，预计2021/08/08 到达，届时快递员将联系您收件，请注意保持电话通畅～";
    contentLabel.font=[UIFont fontWithName:@"PingFang SC" size:autoScaleW(26)];
    [contentLabel layoutIfNeeded];

    if (self.tag%2==0) {
        quanView.backgroundColor=rgba(253,79,25,1);
        contentLabel.textColor=rgba(47,47,47,1);
    }else{
        quanView.backgroundColor=rgba(153,153,153,1);
        contentLabel.textColor=rgba(153,153,153,1);
    }
    
    return 111*_mainHeight+contentLabel.frame.size.height;
}
@end
